package cn.sh.yhk.mapper.basic;

import cn.sh.yhk.model.basic.SFile;
import cn.sh.yhk.model.basic.SFileExample;
import org.apache.ibatis.annotations.*;
import org.apache.ibatis.type.JdbcType;

import java.util.List;

@Mapper
public interface SFileMapper {
    @SelectProvider(type = SFileSqlProvider.class, method = "countByExample")
    long countByExample(SFileExample example);

    @DeleteProvider(type = SFileSqlProvider.class, method = "deleteByExample")
    int deleteByExample(SFileExample example);

    @Insert({
            "insert into s_file (id, file_name, ",
            "path, upload_username, ",
            "create_time, flag)",
            "values (#{id,jdbcType=INTEGER}, #{fileName,jdbcType=VARCHAR}, ",
            "#{path,jdbcType=VARCHAR}, #{uploadUsername,jdbcType=VARCHAR}, ",
            "#{createTime,jdbcType=TIMESTAMP}, #{flag,jdbcType=VARCHAR})"
    })
    int insert(SFile record);

    @InsertProvider(type = SFileSqlProvider.class, method = "insertSelective")
    int insertSelective(SFile record);

    @SelectProvider(type = SFileSqlProvider.class, method = "selectByExample")
    @Results({
            @Result(column = "id", property = "id", jdbcType = JdbcType.INTEGER),
            @Result(column = "file_name", property = "fileName", jdbcType = JdbcType.VARCHAR),
            @Result(column = "path", property = "path", jdbcType = JdbcType.VARCHAR),
            @Result(column = "upload_username", property = "uploadUsername", jdbcType = JdbcType.VARCHAR),
            @Result(column = "create_time", property = "createTime", jdbcType = JdbcType.TIMESTAMP),
            @Result(column = "flag", property = "flag", jdbcType = JdbcType.VARCHAR)
    })
    List<SFile> selectByExample(SFileExample example);

    @UpdateProvider(type = SFileSqlProvider.class, method = "updateByExampleSelective")
    int updateByExampleSelective(@Param("record") SFile record, @Param("example") SFileExample example);

    @UpdateProvider(type = SFileSqlProvider.class, method = "updateByExample")
    int updateByExample(@Param("record") SFile record, @Param("example") SFileExample example);
}